<template>
	<div>
		<hr />
		<p>我是optionData子组件</p>
		<div>{{ name }}</div>
		<button @click="changeName">点我修改父组件name</button>
	</div>
</template>
<script>
export default {
	name: "Son",
	components: {},
	data() {
		return {};
	},
	// props: ["name"],//数组的接收方式
	// props: {
	// 	name: String,
	// },
	props: {
		name: {
			type: String,
			default: "没有接收到",
		},
		fn: Function,
	},
	mounted() {},
	methods: {
		changeName() {
			this.fn("成功修改父组件的name");
		},
	},
};
</script>
<style lang="" scoped></style>
